<?php /* Smarty version 2.6.18, created on 2010-03-16 01:07:05
         compiled from payment.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'cycle', 'payment.tpl', 23, false),array('modifier', 'number_format', 'payment.tpl', 36, false),)), $this); ?>
<form name="mainForm" method="POST" id="mainForm">
    	<h1>Payment Details</h1>
        <div class="blue">
        <p class="right"><input type="button" value="Back to Order" onclick="doajaxAction('/account/createorder',0,'main_content');" />     <input type="button" value="Submit Payment" onclick="return submitPayment();"/></p>
        </div>
           
            <div id="results">
				
                <!-- **************repeat here*************** -->
                
                <div>  
					<?php if ($this->_tpl_vars['orders']): ?>
					
					<table width="100%">
						<tr>
							<td><strong>Supplier</strong></td>
							<td width="20%"><strong>Amount</strong></td>
						</tr>
						<?php $this->assign('totalPayamount', 0); ?>
						<?php $_from = $this->_tpl_vars['orders']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['items']):
?>
							<?php if ($this->_tpl_vars['items']['totalorder'] > 0): ?>	
								 <tr><td colspan="8"><hr></td></tr>
								 <tr class="<?php echo smarty_function_cycle(array('values' => "blue,notify"), $this);?>
">
									<td><?php echo $this->_tpl_vars['items']['supplier']; ?>
</td>
										 <?php $this->assign('totalqty', 0); ?>
										 <?php $this->assign('totalAmount', 0); ?>
										 <?php $_from = $this->_tpl_vars['items']['organismItem']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>							 
											<?php $this->assign('supplier', ($this->_tpl_vars['item']['org_id'])); ?>
											<?php $_from = $this->_tpl_vars['item']['order']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['detail']):
?>									
												<?php if ($this->_tpl_vars['detail'] > 0): ?>										
													<?php $this->assign('totalAmount', ($this->_tpl_vars['totalAmount']+$this->_tpl_vars['detail']*$this->_tpl_vars['item']['price'])); ?>											
												<?php endif; ?>
											<?php endforeach; endif; unset($_from); ?>											
										 <?php endforeach; endif; unset($_from); ?>
										 <?php $this->assign('totalPayamount', ($this->_tpl_vars['totalAmount']+$this->_tpl_vars['totalPayamount'])); ?>
									<td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['totalAmount'])) ? $this->_run_mod_handler('number_format', true, $_tmp, '2%d') : number_format($_tmp, '2%d')); ?>
</td>
								 </tr>
							 <?php endif; ?>							 
						 <?php endforeach; endif; unset($_from); ?>
						  <tr><td colspan="8"><hr></td></tr>
						  <tr><td colspan="8"><hr></td></tr>
						  <tr><td><strong>Total Amount</strong></td><td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['totalPayamount'])) ? $this->_run_mod_handler('number_format', true, $_tmp, '2%d') : number_format($_tmp, '2%d')); ?>
</td></tr>
						  <tr>
							<td colspan="2" align="center">
								<table border="0" width="100%">
									<tr>
										<td width="30%"></td>
										<td width="10%">Payment Type:</td>
										<td>
											<select id="paymentoption" name="paymentoption" onchange="showpayment(this.value)">
												<option value="">--- Select Payment Type ---</option>
												<option value="pp">PayPal</option>
												<option value="wt">Wire Transfer</option>
											</select>
										</td>
										<td width="30%"></td>
									</tr>
									<tr>									
										<td colspan="4" ></td>
									</tr>
									<tr>
										<td width="30%"></td>							
										<td colspan="2" >
											<div id="paymentPanel" style="display:none;">
												<div style="border: 1px #8B8378 solid; padding:5px 5px 5px 5px;background:#FDFCDC;">
													<?php echo $this->_tpl_vars['supplierpaymentinfo']['notice']; ?>

												</div>
												<div style="margin-top: 10px;">
													<table border="0">
														<tr>
															<td>Invoice/Reference Number :</td>
															<td align="left"><input type="text" name="user[reference_no]" value="<?php echo $this->_tpl_vars['supplierpaymentinfo']['reference_no']; ?>
" READONLY style="width:110px"></td>
														</tr>
														<tr>
															<td>Date paid : </td>
															<td align="left"><input type="text" name="user[date_paid]" value="mm/dd/yyyy" style="width:110px" onclick="javascript:this.value='';"></td>
														</tr>	
														<tr>
															<td>Amount : </td>
															<td align="left"><input type="text" name="user[amount]" style="width:110px"></td>
														</tr>	
														<tr>
															<td>Wire Fees : </td>
															<td align="left"><input type="text" name="user[wire_fees]" style="width:200px"></td>
														</tr>	
														<tr>
															<td>Telegraphic Transfer Confirmation Number : </td>
															<td align="left"><input type="text" name="user[tt_no]" style="width:200px"></td>
														</tr>	
														<tr>
															<td style="vertical-align:top;">Comments : </td>
															<td align="left"><textarea name="user[comments]" style="width:250px"></textarea><td>
														</tr>																																																																													
													</table>												
												</div>
											</div>
										</td>
										<td width="30%"></td>
									</tr>									
								</table>
							</td>
						  </tr>				  
					 </table>
					 <?php else: ?>
						 <table width="100%">
							<tr>
                    			<th colspan="2">Empty Shopping Cart</th>
							</tr>
						 </table>
					 <?php endif; ?>
            	</div>                
            </div>
</form>
<script language="javascript">
<?php echo '
	function compute(key){
		var amount = document.getElementById(\'price[\'+key+\']\').value * document.getElementById(\'qty[\'+key+\']\').value;
		document.getElementById(\'amount[\'+key+\']\').value = amount.numberFormat("0,0.00");
	}
	function showpayment(value) {	
		divid = document.getElementById(\'paymentPanel\');
		if (value == \'wt\') {
			divid.style.display = \'block\';
			return true;
		} else if (value == \'pp\') {
			divid.style.display = \'none\';
			return true;
		} else {
			alert(\'Please select payment type!\');
			return false;
		}		
	}
	function submitPayment() {
		pay_option = document.getElementById(\'paymentoption\').value;
		if (pay_option == "") {
			alert(\'Please select payment option!\');
			return false;		
		} else if (pay_option == \'pp\') {
			alert(\'Select another payment option, paypal is not yet supported!\');
			return false;
		} else {
		  doajaxAction(\'/account/submitPayment\',1,\'main_content\',document.getElementById(\'mainForm\'));
		  return true;
		}
	}	
'; ?>

</script>
            
            